package com.njzxw.fs.serversys.repository;

import com.njzxw.fs.commonutil.db.ZxwLangDriver;
import com.njzxw.fs.serversys.bean.LogInfoBean;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface LogInfoRepository {

    @Select("select a.id,a.oper_id,a.oper_name,a.type,DATE_FORMAT(a.oper_date,'%Y-%m-%d %T') oper_date,a.state,a.oper_remark,a.oper_url from t_log_info a where 1=1 and a.oper_id like #{oper_id} and a.oper_name like #{oper_name} and a.type like #{type} and DATE_FORMAT(a.oper_date,'%Y-%m-%d') >= #{min_oper_date} and DATE_FORMAT(a.oper_date,'%Y-%m-%d') <= #{max_oper_date} and a.request_params like #{request_params} and a.return_str like #{return_str} and a.state like #{state} and a.oper_remark like #{oper_remark} and a.oper_url like #{oper_url}")
    @Lang(ZxwLangDriver.class)
    List<Map<String,Object>> queryPage(LogInfoBean logInfoBean);

    @Select("select a.id,a.oper_id,a.oper_name,a.type,DATE_FORMAT(a.oper_date,'%Y-%m-%d %T') oper_date,a.request_params,a.return_str,a.state,a.oper_remark,a.oper_url from t_log_info a where a.id = #{id}")
    Map<String,Object> queryId(LogInfoBean logInfoBean);

    @Update("update t_log_info a (#{logInfoBean}) where  a.id = #{id}")
    @Lang(ZxwLangDriver.class)
    Integer update(LogInfoBean logInfoBean);

    @Delete("delete a from t_log_info a where  a.id in (#{ids})")
    @Lang(ZxwLangDriver.class)
    Integer delete(LogInfoBean logInfoBean);

    @Insert("insert into t_log_info(#{logInfoBean})")
    @Lang(ZxwLangDriver.class)
    @Options(useGeneratedKeys = true)
    Integer insert(LogInfoBean logInfoBean);

}

